import java.util.Scanner;

public class demo01 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int tmp=n;
        while (tmp>2){
            int num=tmp/3;
            tmp%=3;
            n+=num;
            tmp+=num;
        }
        System.out.println(n);
    }
}
